package com.lijie.ljblog.controller;


import com.lijie.ljblog.model.Replay;
import com.lijie.ljblog.service.ReplayService;
import com.lijie.ljblog.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author lijie
 * @since 2021-08-28
 */
@RestController
@RequestMapping("/ljblog/replay")
public class ReplayController {
    @Autowired
    ReplayService replayService;

    //保存回复
    @RequestMapping("insertReplay")
    public Result<Object> insertReplay(@RequestBody Replay replay, HttpServletRequest request){
        Result<Object> result=new Result<>();
        try {
            result= replayService.saveOrUpdateReplay(replay,request);
        } catch (Exception e) {
            result.setErrored(e.getMessage());
        }
        return result;
    }
}

